local skynet = require "skynet"

local service_class = class("service_class")
local table_unpack = table.unpack

function service_class:ctor()
   
end

function service_class:reload()
end

function service_class:initalize()
end

function service_class:ret(ok,...)
    if not ok then
        errlog('failed to ret',sys_tostring(...))
        return skynet.retpack(false)
    end

    local arg = { ... }
    if #arg > 0 then
        return skynet.retpack(...)
    else
        return skynet.retpack(false)
    end
end

function service_class:register_dispatch()
    skynet.dispatch("lua",function(session,source,action,...)
        dbglog('internal request',self.__cname,action,...)
        --self:ret(self[action](self,...))
        self:ret(xpcall(self[action],debug.traceback,self,...))
    end)
end

function service_class:load_config()
end

return service_class